package cloud.lysky.java.on.concurrent.thread;

/**
 * @author luoly
 * @describe
 * @date 2023/2/27 18:02
 **/
public class ThreadStartDemo{
    public static void main(String[] args) {
        //将runnable接口实现类放在Thread中执行
        Thread thread = new Thread(new MyRunnable());
        //启动线程
        thread.start();
    }
}
//实现Runnable接口
class MyRunnable implements Runnable{
    @Override
    public void run() {
        System.out.println("My runnable is running...");
    }
}
//继承Thread对象
class MyThread extends Thread{
    @Override
    public void run() {
        //该线程要执行的代码
        System.out.println("My thread is running...");
    }
}



